<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<link rel="stylesheet" th:href="@{/plugin/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css}">
<body class="hold-transition skin-blue sidebar-mini">

<section class="content-header">
    <h1>铆焊厂产能统计</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label for="query-plaEndDat">排产计划完成时间</label>
                                    <input id="query-plaEndDat" name="prpdPlaEndDat" type="text"
                                           class="form-control dt-p"
                                           th:value="${#dates.format(plaEndDat,'yyyy-MM')}" readonly>
                                </div>
                                <div class="form-group">
                                    <label for="query-prodNo">生产令号</label>
                                    <input id="query-prodNo" type="text" name="prodNo" class="form-control"
                                           placeholder="请输入生产令号">
                                </div>
                                <div class="form-group">
                                    <label for="query-proName">项目名称</label>
                                    <input id="query-proName" type="text" name="proName" class="form-control"
                                           placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label for="query-part">部分</label>
                                    <input id="query-part" type="text" name="part" class="form-control"
                                           placeholder="请输入部分">
                                </div>
                                <div class="form-group">
                                    <label for="query-drawNo">图号</label>
                                    <input id="query-drawNo" type="text" name="drawNo" class="form-control"
                                           placeholder="请输入图号">
                                </div>
                                <div class="form-group">
                                    <label for="query-drawName">图名</label>
                                    <input id="query-drawName" type="text" name="drawName" class="form-control"
                                           placeholder="请输入图名">
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search"
                                        onclick="js.table.search(table)">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:src="@{/plugin/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js}"></script>
<script th:src="@{/plugin/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js}"></script>
<script th:inline="javascript">

    let table;

    $(function () {

        $('.dt-p').datetimepicker({
            format: 'yyyy-mm',
            weekStart: 1,
            autoclose: true,
            startView: 3,
            minView: 3,
            forceParse: false,
            language: 'zh-CN'
        });

        /** 加载列表 */
        table = js.table.init({
            url: ctx + "overview/weldStatsList",
            showColumns: true,
            showExport: true,
            columns: [
                {
                    title: '序号', field: 'id', width: '50',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: "生产令号", field: 'prodNo'},
                {title: "项目名称", field: 'proName'},
                {title: "类型", field: 'special'},
                {title: "部分", field: 'part'},
                {title: "图号", field: 'drawNo'},
                {title: "图名", field: 'drawName'},
                {title: "零件数量", field: 'drawNum'},
                {title: "单件重量", field: 'weight'},
                {title: "总重量", field: 'plaWeight'},
                {title: "当月完成<br>重量", field: 'comWeight'},
                {title: "计划开始<br>时间", field: 'prpdPlaStaDat'},
                {title: "计划完成<br>时间", field: 'prpdPlaEndDat'},
                {
                    title: "当月完成<br>状态", field: 'status',
                    formatter: function (value) {
                        if (value == 4) {
                            return '<span class="badge label-success">完成</span>';
                        } else {
                            return '<span class="badge label-inverse">未完成</span>';
                        }
                    }
                }
            ]
        });
    });

</script>
</body>
</html>
